package com.gagakuai.bpm.rpcservice.openfeign;


import com.gagakuai.bpm.config.httpclients.FeignConfig;
import com.gagakuai.bpm.domian.entity.camuda.BrokerMessageLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/*
 * @program: mss_server
 * @description: 基于mq的日志服务
 * @author: houhong
 * @create: 2022-03-24 19:51
 */

@FeignClient(name = "msgLogApi",url = "http://localhost:8081",
        decode404 = true,
        configuration = FeignConfig.class)
public interface MsgLogApi {



    /*
     * 查询消息状态为0(发送中) 且已经超时的消息集合
     *
     * @return
     */
    @GetMapping("/getStatusAndTimeoutMessage")
    List<BrokerMessageLog> getStatusAndTimeoutMessage();

    @GetMapping("/getMessageLogById/{messageId}")
    BrokerMessageLog  getMessageLogById(@PathVariable("messageId")String messageId);

    /*
     * 重新发送统计count发送次数 +1
     *
     * @param messageId
     */
    @PostMapping("/getStatusAndTimeoutMessage/{messageId}")
    void updateForReSend(@PathVariable("messageId") String messageId);



    /*
     * 更新最终消息发送结果 成功 or 失败
     *
     * @param correlationId
     * @param bpmWithDeawConsumeSuccess
     */
    @PostMapping("/changeBrokerMessageLogStatus/{messageId}/{bpmWithDeawConsumeSuccess}")
    void changeBrokerMessageLogStatus(@PathVariable("correlationId") String correlationId,
                                      @PathVariable("bpmWithDeawConsumeSuccess") String bpmWithDeawConsumeSuccess);


}


